class RandomWeapon extends Actor placeable;

var () int wep;
var () int rotationSpeed;

simulated function PostBeginPlay()
{
	super.PostBeginPlay();
	wep = 1+Rand(2);
}

auto state CheckPickup
{
	event Tick(float deltaTime)
	{
		local RaceCar obj;
		local Rotator r;
		obj = checkObjectRadius(200);
		if(obj!=none)
		{
			obj.selectWeapon(wep);
		}
		r.Yaw += rotationSpeed;
		SetRotation(Rotation + r);
		//`log(wep);
	}
}

function RaceCar checkObjectRadius(int radius){
    local float distancePlayerBot;
	local Controller C;
	foreach WorldInfo.AllControllers(class'Controller', C)
	{	
		if (C.bIsPlayer && !C.IsDead())
		{
			distancePlayerBot = VSize(C.Pawn.Location - self.Location);
			if( distancePlayerBot < radius)
			{	
				return RaceCar(C.Pawn);
			}
		}
	}
	return none;
}

DefaultProperties
{
	Begin Object class=StaticMeshComponent name=projmesh
                     StaticMesh =StaticMesh'Artalpha.doosje'
					 Translation = (X=40,Y=40,Z=0)
					 bUsePrecomputedShadows = true;	
	End Object
           Components.Add(projmesh)
           ProjSMC = projmesh
	bCollideWorld = false;

	rotationSpeed = 1
	
}
